package org.nlp2rdf.navigator.benchmark.cli;

import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.rdf.model.ResourceFactory;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Options;
import org.nlp2rdf.navigator.benchmark.*;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Random;
import java.util.Set;

/**
 * Created by Claus Stadler
 * Date: Oct 25, 2010
 * Time: 12:05:21 AM
 */
public class RunBenchmarkHistory {
    private static Options cliOptions = new Options()
        .addOption("c", "configFile", true, "Spring XML config")
        .addOption("k", "category", true, "Category");

    public static void main(String[] args)
            throws Exception
    {
        CommandLine commandLine = CliUtils.getGnuCommandLine(cliOptions, args);
        //ApplicationContext context = CliUtils.getApplicationContext(commandLine, commandLine.getOptionValue("c"));
        ApplicationContext context = new ClassPathXmlApplicationContext(new String[] {commandLine.getOptionValue("c"), "benchmark_common.xml"});


        BenchmarkContext con = new BenchmarkContext(context);

        Random random = (Random)context.getBean("benchmark.random");


        Resource category = ResourceFactory.createResource(commandLine.getOptionValue("k"));
        Set<Resource> positives = MySparqlTasks.getTypedDBpediaCategoryMembers(con.getSparqlEndpoint(), con.getGraphNames(), category);
        Sample<Resource> pool = PoolUtils.generateNavigationPool(con.getSparqlEndpoint(), con.getGraphNames(), category, positives, random);

        //RunBenchmark.runBenchmark(con, "basePath", numFolds, numPhases, category, pool, random, "experimentName", phaseReconfigurator);
    }

}
